package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.OperationDao;
import com.itheima.dao.StudentDao;
import com.itheima.domain.Option;
import com.itheima.domain.Student;
import com.itheima.service.StudentService;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;
    @Autowired
    private OperationDao optionDao;

    public void setOptionDao(OperationDao optionDao) {
        this.optionDao = optionDao;
    }

    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Override
    public PageInfo findByPage(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage, pageSize);
        List<Student> list = studentDao.findAll();
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;

    }

    @Override
    public void insert(Student student) {

        studentDao.insert(student);
    }

    @Override
    public void update(Student student) {
        studentDao.update(student);
    }

    @Override
    public void delete(String number) {
        studentDao.delete(number);
    }

}
